package com.yanmaohu.yulia.bean;

import java.util.List;

/**
 * @author Bright Lee
 */
public final class ArrayElementList {

    private int beginIndex;
    private int endIndex;
    private List<ValueExpression> arrayElementList;

    public ArrayElementList(List<ValueExpression> arrayElementList) {
        this.beginIndex = arrayElementList.get(0).getBeginIndex();
        this.endIndex = arrayElementList.get(arrayElementList.size() - 1).getEndIndex();
        this.arrayElementList = arrayElementList;
    }

    public int getBeginIndex() {
        return beginIndex;
    }

    public int getEndIndex() {
        return endIndex;
    }

    private boolean isEmpty() {
        return arrayElementList == null ? true : arrayElementList.isEmpty();
    }

    public int size() {
        return arrayElementList == null ? 0 : arrayElementList.size();
    }

    public ValueExpression get(int index) {
        if (arrayElementList == null) {
            return null;
        }
        return arrayElementList.get(index);
    }

}
